package cn.fatgod.learn.thymeleaf.template;

/*[- */
    类路径导入
/* -]*/
[# th:each="importPath : ${importPaths}"]
    import [(${importPath})];
[/]
[# th:if="${needSerialize}"]import java.io.Serializable;[/]

/*[- */
    类注解
/* -]*/
[# th:each="annotation : ${annotations}"]
@[(${annotation.name})]
    [# th:if = "${annotation.hasProperty}"]
        ([# th:each="property,ps : ${annotation.properties}"]
            [# th:if = "${ps.index} > 0"],[/]
            [(${property.key})] =
            [# th:if = "${property.type} == 'STR'"]"[(${property.value})]"[/]
            [# th:if = "${property.type} == 'TEXT'"][(${property.value})][/]
        [/])
    [/]
[/]

/*[- */
    类签名
/* -]*/
[(${modifier})] class [(${name})]
[# th:if = "${needExtend}"] extends
    [# th:each="extend,es : ${extendList}"]
        [# th:if = "${es.index} > 0"],[/] [(${extend})]
    [/]
[/]
[# th:if = "${needImpl}"] implements
    [# th:if="${needSerialize}"] Serializable[/]
    [# th:each="impl,is : ${implList}"]
        [# th:if = "${is.index} > 0 or ${needSerialize}"],[/] [(${impl})]
    [/]
[/]
/*[- */
    成员
/* -]*/
{
    [# th:if="${needSerialize}"]private static final long serialVersionUID = 1L;[/]
    [# th:each="field : ${fields}"]
        /*[- */
            字段注解
        /* -]*/
        [# th:each="annotation : ${field.annotations}"]
        @[(${annotation.name})]
            [# th:if = "${annotation.hasProperty}"]
                ([# th:each="property,ps : ${annotation.properties}"]
                    [# th:if = "${ps.index} > 0"],[/]
                    [(${property.key})] =
                    [# th:if = "${property.type} == 'STR'"]"[(${property.value})]"[/]
                    [# th:if = "${property.type} == 'TEXT'"][(${property.value})][/]
                [/])
            [/]
        [/]
        [(${field.modifier})] [(${field.type})] [(${field.name})];
    [/]
}